<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>输出图象到浏览器或文件。</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="function.image-type-to-mime-type.html">« image_type_to_mime_type</a></li>
      <li style="float: right;"><a href="function.imageaffine.html">imageaffine »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="ref.image.html">GD 和图像处理 函数</a></li>
    <li>输出图象到浏览器或文件。</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="function.image2wbmp" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">image2wbmp</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.5, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">image2wbmp</span> &mdash; <span class="dc-title">输出图象到浏览器或文件。</span></p>

 </div>

 <div id="function.image2wbmp-refsynopsisdiv">
  <div class="warning"><strong class="warning">警告</strong><p class="simpara">本函数已自 PHP 7.3.0
起<em class="emphasis">弃用</em>，自 PHP 8.0.0 起<em class="emphasis">移除</em>。强烈建议不要依赖本函数。</p></div>
 </div>

 <div class="refsect1 description" id="refsect1-function.image2wbmp-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>image2wbmp</strong></span>(<span class="methodparam"><span class="type">resource</span> <code class="parameter">$image</code></span>, <span class="methodparam"><span class="type">string</span> <code class="parameter">$filename</code><span class="initializer"> = ?</span></span>, <span class="methodparam"><span class="type">int</span> <code class="parameter">$foreground</code><span class="initializer"> = ?</span></span>): <span class="type">bool</span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>image2wbmp()</strong></span> 输出或保存为指定 <code class="parameter">image</code> 的 <abbr title="Wireless Bitmap">WBMP</abbr> 版本。
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.image2wbmp-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt>
<code class="parameter">image</code></dt>

     <dd>

      <p class="para">
       图像资源，由某个图像创建函数返回，比如 <span class="function"><a href="function.imagecreatetruecolor.html" class="function">imagecreatetruecolor()</a></span>。
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">filename</code></dt>

     <dd>

      <p class="para">
       保存文件的路径。如果没有指定，将直接输出原始图片流。
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">foreground</code></dt>

     <dd>

      <p class="para">
       使用此参数从 <span class="function"><a href="function.imagecolorallocate.html" class="function">imagecolorallocate()</a></span> 获得的标识符来设置前景色。默认前景色为黑色。
      </p>
     </dd>

    
   </dl>

  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.image2wbmp-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code>true</code></strong>， 或者在失败时返回 <strong><code>false</code></strong>。
  </p>
  <div class="caution"><strong class="caution">警告</strong><p class="simpara">如果 libgd 输出图像失败，函数会返回 <strong><code>true</code></strong>。</p></div>
 </div>

 <div class="refsect1 examples" id="refsect1-function.image2wbmp-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-2623">
    <p><strong>示例 #1 <span class="function"><strong>image2wbmp()</strong></span> 示例</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$file&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'php.png'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$image&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">imagecreatefrompng</span><span style="color: #007700">(</span><span style="color: #0000BB">$file</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">header</span><span style="color: #007700">(</span><span style="color: #DD0000">'Content-Type:&nbsp;'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">image_type_to_mime_type</span><span style="color: #007700">(</span><span style="color: #0000BB">IMAGETYPE_WBMP</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">image2wbmp</span><span style="color: #007700">(</span><span style="color: #0000BB">$image</span><span style="color: #007700">);&nbsp;</span><span style="color: #FF8000">//&nbsp;直接输出流<br /></span><span style="color: #0000BB">imagedestroy</span><span style="color: #007700">(</span><span style="color: #0000BB">$image</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.image2wbmp-seealso">
  <h3 class="title">参见</h3>
  <ul class="simplelist">
   <li class="member"><span class="function"><a href="function.imagewbmp.html" class="function" rel="rdfs-seeAlso">imagewbmp()</a> - 输出图象到浏览器或文件。</span></li>
  </ul>
 </div>

</div></div></div></body></html>